<?php

/*
 * Built by :
 * Andi Kurniawan (fandikurniawan89@gmail.com) at system and database and
 */

class Mmr extends CI_Model {

    function login($input) {
        $this->db->select('pri');
        $this->db->where('username', $input['username']);
        $this->db->where('password', $input['password']);
        $data = $this->db->get('user');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function judul($input) {
        $this->db->insert('judul', $input);
    }

    function log_judul($nim) {
        $this->db->order_by('submit', 'asc');
        $this->db->where('nim', $nim);
        $judul = $this->db->get('judul');
        if ($judul->num_rows > 0) {
            return $judul->result();
        }
    }

    function stat($nim) {
        $this->db->select('status');
        $this->db->where('nim', $nim);
        $this->db->order_by('date', 'desc');
        $stat = $this->db->get('judul');
        return $stat->row();
    }

    function pengajuan_judul() {
        $this->db->where('status', 'Submitted');
        $judul = $this->db->get('judul');
        if ($judul->num_rows > 0) {
            return $judul->result();
        }
    }

    function daftar_pengajuan_judul() {
        $this->db->select('DISTINCT(a.nim),a.id,b.nama,a.judul_1,a.judul_2,a.submit');
        $this->db->from('judul a');
        $this->db->join('mahasiswa b', 'a.nim = b.nim');
        $this->db->where('a.status', 'Submitted');
        $this->db->group_by('a.nim');
        $this->db->order_by('a.date', 'desc');
        $judul = $this->db->get();
        if ($judul->num_rows > 0) {
            return $judul->result();
        }
    }

    function daftar_judul() {
        $this->db->select('a.id,b.nim,c.nama mhs,a.judul,d.nama dos,e.nama dosen');
        $this->db->from('pembimbing a');
        $this->db->join('judul b', 'a.id = b.id');
        $this->db->join('mahasiswa c', 'b.nim = c.nim');
        $this->db->join('dosen d', 'a.dosen_1 = d.nip');
        $this->db->join('dosen e', 'a.dosen_2 = e.nip');
        $judul = $this->db->get();
        if ($judul->num_rows > 0) {
            return $judul->result();
        }
    }

    function judul_saran($id) {
        $this->db->where('judul_id', $id);
        $data = $this->db->get('judul-saran');
        return $data->row();
    }

    function update_judul_saran($id, $update) {
        $this->db->where('id', $id);
        $this->db->update('judul', $update);
    }

    function simpan_saran($input) {
        $this->db->insert('judul-saran', $input);
    }

    function saran_judul($saran_id) {
        $this->db->order_by('date', 'desc');
        $this->db->where('judul_id', $saran_id);
        $data = $this->db->get('judul-saran');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function saran_update($id, $update) {
        $this->db->where('id', $id);
        $this->db->update('judul-saran', $update);
    }

    function confirm($id) {
        $this->db->where('id', $id);
        $data = $this->db->get('judul');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function dosen() {
        $data = $this->db->get('dosen');
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function dosen_bimb() {
        $data = $this->db->query('SELECT a.nip,a.nama,a.email,COUNT(b.nip) jml FROM dosen a LEFT JOIN COUNT b ON a.nip=b.nip WHERE b.stat IS NULL OR b.stat="Active" GROUP BY a.nip');
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function acc($id, $data) {
        $this->db->where('id', $id);
        $this->db->update('judul', $data);
    }

    function pembimbing($dosen) {
        $this->db->insert('pembimbing', $dosen);
    }

    function tesis($nim) {
        $this->db->select('d.nim,a.id,d.subyek,d.submit date,b.nama dos,b.telp hp,c.nama dosen,c.telp,a.judul');
        $this->db->from('pembimbing a');
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $this->db->join('judul d', 'a.id=d.id');
        $this->db->where('d.nim', $nim);
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function surat($nim) {
        $this->db->select('b.id, b.judul,a.subyek');
        $this->db->from('judul a');
        $this->db->where('a.nim', $nim);
        $this->db->join('pembimbing b', 'a.id = b.id');
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function cek_surat($nim) {
        $this->db->select('a.id,b.nim');
        $this->db->from('surat a');
        $this->db->join('judul b', 'a.id=b.id');
        $this->db->where('b.nim', $nim);
        $data = $this->db->get();
        return $data->num_rows();
    }

    function let($input) {
        $this->db->insert('surat', $input);
    }

    function menu_surat($nim) {
        $this->db->select('*');
        $this->db->from('pembimbing a');
        $this->db->join('judul b', 'a.id=b.id');
        $this->db->where('b.nim', $nim);
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return TRUE;
        }
    }

    function menu_profil($nim) {
        $this->db->select('status');
        $this->db->where('nim', $nim);
        $this->db->order_by('date', 'desc');
        $data = $this->db->get('judul');
//        if ($data->num_rows > 0) {
        return $data->row();
//        }
    }

    function get_id_tesis($nim) {
        $this->db->where('nim', $nim);
        $this->db->order_by('date', 'desc');
        $data = $this->db->get('judul');
        return $data->row();
    }

    function insert_upload($input) {
        $this->db->insert('uploads', $input);
    }

    function get_babSaran($kode) {
        $this->db->select('bab,kode,uploader');
        $this->db->where('kode', $kode);
        $data = $this->db->get('uploads');
        return $data->row();
    }

    function get_bab($kode) {
        $this->db->select('bab,kode,uploader');
        $this->db->where('hash', $kode);
        $data = $this->db->get('uploads');
        return $data->row();
    }

    function update_status($kode, $data) {
        $this->db->where('hash', $kode);
        $this->db->update('uploads', $data);
    }

    function bimbingan_proposal($nim) {
        $this->db->select('a.hash,a.kode,a.time,a.file_name,a.full_path,a.bab,a.status,a.koreksi');
        $this->db->from('uploads a');
        $this->db->join('judul b', 'a.kode=b.id');
        $this->db->where('a.tipe', 'Proposal');
        $this->db->where('b.nim', $nim);
        $this->db->where('a.uploader', $nim);
        $this->db->order_by('a.date', 'desc');
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function bimbingan_tesis($nim) {
        $this->db->select('a.hash,a.kode,a.time,a.file_name,a.full_path,a.bab,a.status');
        $this->db->from('uploads a');
        $this->db->join('judul b', 'a.kode=b.id');
        $this->db->where('a.tipe', 'Tesis');
        $this->db->where('b.nim', $nim);
        $this->db->where('a.uploader', $nim);
        $this->db->order_by('a.date', 'desc');
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function get_link($id) {
        $this->db->where('hash', $id);
//        $this->db->where('uploader', $user);
        $data = $this->db->get('uploads');
        return $data->row();
    }

    function get_link_dosen($id) {
        $this->db->where('hash', $id);
        $data = $this->db->get('uploads');
        return $data->row();
    }

    function get_link_dos($id, $user) {
        $this->db->where('kode', $id);
        $this->db->where_not_in('uploader', $user);
        $data = $this->db->get('uploads');
        return $data->row();
    }

    function peserta_bimbingan($id) {
        $this->db->select('DISTINCT(a.id),a.judul,b.nim,c.nama');
        $this->db->from('pembimbing a');
        $this->db->join('judul b', 'a.id=b.id');
        $this->db->join('mahasiswa c', 'b.nim=c.nim');
        $this->db->join('uploads d', 'a.id=d.kode');
        $this->db->where('a.dosen_1', $id);
        $this->db->or_where('a.dosen_2', $id);
        $this->db->where('d.tipe', 'Proposal');
        $this->db->where('d.uploader !=', $id);
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function bimbingan_proposal_dosen($id, $user) {
        $this->db->where('kode', $id);
        $this->db->where('tipe', 'Proposal');
        $this->db->where_not_in('uploader', $user);
        $data = $this->db->get('uploads');
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function confirm_proposal_dosen($id, $data) {
        $this->db->where('hash', $id);
        $this->db->update('uploads', $data);
    }

    function proposal_saran_save($insert) {
        $this->db->insert('proposal-saran', $insert);
    }

    function update_proposal_status($id, $update) {
        $this->db->where('hash', $id);
        $this->db->update('uploads', $update);
    }

    function proposal_saran_log($id) {
        $this->db->where('id', $id);
        $data = $this->db->get('proposal-saran');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function log_bimbingan($nim) {
        $this->db->select('a.hash,a.kode,a.time,a.file_name,a.full_path,a.bab,a.status');
        $this->db->from('uploads a');
        $this->db->join('judul b', 'a.kode=b.id');
        $this->db->where('b.nim', $nim);
        $this->db->where('a.uploader', $nim);
        $this->db->order_by('a.time', 'desc');
        $this->db->order_by('a.bab', 'asc');
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function get_mhs($id) {
        $this->db->select('b.nama,b.telp,b.email');
        $this->db->from('judul a');
        $this->db->join('mahasiswa b', 'a.nim=b.nim');
        $this->db->where('a.id', $id);
        $data = $this->db->get();
        return $data->row();
    }

    function get_mahasiswa($id) {
        $this->db->where('nim', $id);
        $data = $this->db->get('mahasiswa');
        return $data->row();
    }

    function bimbingan_tesis_dosen($id, $user) {
        $this->db->where('kode', $id);
        $this->db->where('tipe', 'Tesis');
        $this->db->where_not_in('uploader', $user);
        $data = $this->db->get('uploads');
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function peserta_tesis($id) {
        $this->db->select('DISTINCT(a.id),a.judul,b.nim,c.nama');
        $this->db->from('pembimbing a');
        $this->db->join('judul b', 'a.id=b.id');
        $this->db->join('mahasiswa c', 'b.nim=c.nim');
        $this->db->join('uploads d', 'a.id=d.kode');
        $this->db->where('d.tipe', 'Tesis');
        $this->db->where('a.dosen_1', $id);
        $this->db->or_where('a.dosen_2', $id);
        $data = $this->db->get();
//        $data = $this->db->query('SELECT DISTINCT(d.kode),a.judul,b.nim,c.nama,d.tipe FROM pembimbing a JOIN judul b ON a.id=b.id JOIN mahasiswa c ON b.nim=c.nim JOIN uploads d ON a.id=d.kode WHERE d.tipe="Tesis" LIKE a.dosen_1="andi" AND a.dosen_2="andi"');
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function get_seminar_proposal($nim) {
        $this->db->select('a.id,a.nim,b.nama dosen_1,c.nama dosen_2,d.nama dosen_3,e.nama dosen_4,a.type,a.tgl');
        $this->db->from('seminar a');
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $this->db->join('dosen d', 'a.dosen_3=d.nip');
        $this->db->join('dosen e', 'a.dosen_4=e.nip');
        $this->db->where('a.nim', $nim);
        $this->db->where('a.type', 'Proposal');
        $data = $this->db->get();
        return $data->result();
    }

    function get_seminar_tesis($nim) {
        $this->db->select('a.id,a.nim,b.nama dosen_1,c.nama dosen_2,d.nama dosen_3,e.nama dosen_4,a.type,a.tgl');
        $this->db->from('seminar a');
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $this->db->join('dosen d', 'a.dosen_3=d.nip');
        $this->db->join('dosen e', 'a.dosen_4=e.nip');
        $this->db->where('a.nim', $nim);
        $this->db->where('a.type', 'Tesis');
        $data = $this->db->get();
        return $data->result();
    }

    function get_seminar_hasil($nim) {
        $this->db->select('a.id,a.nim,b.nama dosen_1,c.nama dosen_2,d.nama dosen_3,e.nama dosen_4,a.type,a.tgl');
        $this->db->from('seminar a');
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $this->db->join('dosen d', 'a.dosen_3=d.nip');
        $this->db->join('dosen e', 'a.dosen_4=e.nip');
        $this->db->where('a.nim', $nim);
        $this->db->where('a.type', 'Hasil');
        $data = $this->db->get();
        return $data->result();
    }

    function regis_proposal($data) {
        $this->db->insert('seminar', $data);
    }

    function jdwl_proposal() {
        $this->db->select('a.id,a.nim,b.nama,d.judul');
        $this->db->from('seminar a');
        $this->db->where('a.type', 'Proposal');
        $this->db->join('mahasiswa b', 'a.nim=b.nim');
        $this->db->join('judul c', 'a.nim=c.nim');
        $this->db->join('pembimbing d', 'c.id=d.id');
        $data = $this->db->get();
        return $data->result();
    }

    function rep_jdwl_proposal() {
        $this->db->select('a.id,a.nim,b.nama "dosen_1",c.nama "dosen_2",d.nama "dosen_3",e.nama "dosen_4",a.tgl');
        $this->db->from('seminar a');
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $this->db->join('dosen d', 'a.dosen_3=d.nip');
        $this->db->join('dosen e', 'a.dosen_4=e.nip');
        $this->db->where('a.type', 'Proposal');
        $data = $this->db->get();
        return $data->result();
    }

    function rep_jdwl_tesis() {
        $this->db->select('a.id,a.nim,b.nama "dosen_1",c.nama "dosen_2",d.nama "dosen_3",e.nama "dosen_4",a.tgl');
        $this->db->from('seminar a');
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $this->db->join('dosen d', 'a.dosen_3=d.nip');
        $this->db->join('dosen e', 'a.dosen_4=e.nip');
        $this->db->where('a.type', 'Tesis');
        $data = $this->db->get();
        return $data->result();
    }

    function jdwl_seminar() {
        $this->db->select('a.id,a.nim,b.nama,d.judul');
        $this->db->from('seminar a');
        $this->db->where('a.type', 'Tesis');
        $this->db->join('mahasiswa b', 'a.nim=b.nim');
        $this->db->join('judul c', 'a.nim=c.nim');
        $this->db->join('pembimbing d', 'c.id=d.id');
        $data = $this->db->get();
        return $data->result();
    }

    function jdwl_hasil() {
        $this->db->select('a.id,a.nim,b.nama,d.judul');
        $this->db->from('seminar a');
        $this->db->where('a.type', 'Hasil');
        $this->db->join('mahasiswa b', 'a.nim=b.nim');
        $this->db->join('judul c', 'a.nim=c.nim');
        $this->db->join('pembimbing d', 'c.id=d.id');
        $data = $this->db->get();
        return $data->result();
    }

    function get_nim_seminar($id) {
        $this->db->where('id', $id);
        $data = $this->db->get('seminar');
        return $data->row();
    }

    function jdwl_proposal_save($id, $data) {
        $this->db->where('id', $id);
        $this->db->update('seminar', $data);
    }

    function jdwl_hasil_save($id, $data) {
        $this->db->where('id', $id);
        $this->db->update('seminar', $data);
    }

    function det_pro($id) {
        $this->db->select('a.id,a.nim,b.nama dosen_1,c.nama dosen_2,d.nama dosen_3,e.nama dosen_4,a.type,a.tgl');
        $this->db->from('seminar a');
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $this->db->join('dosen d', 'a.dosen_3=d.nip');
        $this->db->join('dosen e', 'a.dosen_4=e.nip');
        $this->db->where('a.id', $id);
        $data = $this->db->get();
        return $data->result();
    }

    function det_sem($id) {
        $this->db->select('a.id,a.nim,b.nama dosen_1,c.nama dosen_2,d.nama dosen_3,e.nama dosen_4,a.type,a.tgl');
        $this->db->from('seminar a');
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $this->db->join('dosen d', 'a.dosen_3=d.nip');
        $this->db->join('dosen e', 'a.dosen_4=e.nip');
        $this->db->where('a.id', $id);
        $data = $this->db->get();
        return $data->result();
    }

    function det_hasil_sem($id) {
        $this->db->select('a.id,a.nim,b.nama dosen_1,c.nama dosen_2,d.nama dosen_3,e.nama dosen_4,a.type,a.tgl');
        $this->db->from('seminar a');
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $this->db->join('dosen d', 'a.dosen_3=d.nip');
        $this->db->join('dosen e', 'a.dosen_4=e.nip');
        $this->db->where('a.id', $id);
        $this->db->where('a.type', 'Hasil');
        $data = $this->db->get();
        return $data->result();
    }

    function email_mhs($nim) {
        $this->db->select('email');
        $this->db->where('nim', $nim);
        $data = $this->db->get('mahasiswa');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function email_dsn($nim) {
        $this->db->select('email');
        $this->db->where('nip', $nim);
        $data = $this->db->get('dosen');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function get_nim_judul($id) {
        $this->db->select('nim');
        $this->db->where('id', $id);
        $data = $this->db->get('judul');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function get_email_dosen($do) {
        $this->db->select('email');
        $this->db->where('nip', $do);
        $data = $this->db->get('dosen');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function srt() {
        $this->db->select('a.no,a.id,a.subyek,a.lokasi,a.cetak,a.date,b.nim,c.nama,c.alamat,d.judul,d.dosen_1,d.dosen_2');
        $this->db->from('surat a');
        $this->db->join('judul b', 'a.id=b.id');
        $this->db->join('mahasiswa c', 'b.nim=c.nim');
        $this->db->join('pembimbing d', 'a.id=d.id');
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function ltr($id) {
        $this->db->select('a.no,a.id,a.subyek,a.lokasi,a.cetak,a.date,b.nim,c.nama,c.alamat,d.judul,e.nama nados_1,f.nama nados_2');
        $this->db->from('surat a');
        $this->db->where('a.id', $id);
        $this->db->join('judul b', 'a.id=b.id');
        $this->db->join('mahasiswa c', 'b.nim=c.nim');
        $this->db->join('pembimbing d', 'a.id=d.id');
        $this->db->join('dosen e', 'd.dosen_1=e.nip');
        $this->db->join('dosen f', 'd.dosen_2=f.nip');
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function cetak($id, $upd) {
        $this->db->where('id', $id);
        $this->db->update('surat', $upd);
    }

    function user_add($input) {
        $this->db->insert('user', $input);
    }

    function insert_dosen($insert) {
        $this->db->insert('dosen', $insert);
    }

    function get_dosen($config) {
        $this->db->order_by('nama');
        $data = $this->db->get('dosen', $config['per_page'], $config['uri']);
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function mahasiswa($config) {
        $this->db->order_by('angkatan');
        $this->db->order_by('nama');
        $data = $this->db->get('mahasiswa', $config['per_page'], $config['uri']);
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function insert_mahasiswa($insert) {
        $this->db->insert('mahasiswa', $insert);
    }

    function count_mahasiswa() {
        $data = $this->db->count_all_results('mahasiswa');
        return $data;
    }

    function count_dosen() {
        $data = $this->db->count_all_results('dosen');
        return $data;
    }

    function count_srt() {
        $data = $this->db->count_all_results('surat');
        return $data;
    }

    function get_nama($nim) {
        $this->db->select('nama,nim');
        $this->db->where('nim', $nim);
        $data = $this->db->get('mahasiswa');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function get_nama_dosen($nim) {
//        $this->db->select('nama,nip');
        $this->db->where('nip', $nim);
        $data = $this->db->get('dosen');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function nip_nim($aa) {
        $this->db->insert('count', $aa);
    }

    function deactive($nim, $dea) {
        $this->db->where('nim', $nim);
        $this->db->update('count', $dea);
    }

    function updatePass($id, $update) {
        $this->db->where('username', $id);
        $this->db->update('user', $update);
    }

    function updateEmail($id, $email) {
        $this->db->where('nim', $id);
        $this->db->update('mahasiswa', $email);
    }

    function updateMail($id, $email) {
        $this->db->where('nip', $id);
        $this->db->update('dosen', $email);
    }

    function mail_pemb($id) {
        $this->db->select('b.email em1,c.email em2');
        $this->db->from('pembimbing a');
        $this->db->where('a.id', $id);
        $this->db->join('dosen b', 'a.dosen_1=b.nip');
        $this->db->join('dosen c', 'a.dosen_2=c.nip');
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function get_mail_mhs($kode) {
        $this->db->select('b.email');
        $this->db->from('judul a');
        $this->db->join('mahasiswa b', 'a.nim=b.nim');
        $this->db->where('a.id', $kode);
        $data = $this->db->get();
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function updPassAdm($id, $update) {
        $this->db->where('username', $id);
        $this->db->update('user', $update);
    }

    function gantiPas($id, $pass) {
        $this->db->where('username', $id);
        $this->db->update('user', $pass);
    }

    function delUser($id) {
        $this->db->where('username', $id);
        $this->db->delete('user');
    }

    function bimpro($nim) {
        $this->db->select('*');
        $this->db->where('nim', $nim);
        $this->db->where('type', 'Proposal');
        $this->db->from('seminar');
        $data = $this->db->get();
        if ($data->num_rows() > 0) {
            return TRUE;
        }
    }

    function bimtes($nim) {
        $this->db->select('*');
        $this->db->where('nim', $nim);
        $this->db->where('type', 'Tesis');
        $this->db->from('seminar');
        $data = $this->db->get();
        if ($data->num_rows() > 0) {
            return TRUE;
        }
    }

    function semHas($data) {
        $this->db->insert('seminar', $data);
    }

    function cek_semhas($nim) {
        $this->db->where('nim', $nim);
        $this->db->where('type', 'Hasil');
        $data = $this->db->get('seminar');
        if ($data->num_rows > 0) {
            return $data->num_rows();
        }
    }

    function upload_photo($id, $input) {
        $this->db->where('nip', $id);
        $this->db->update('dosen', $input);
    }

    function updateMahasiswa($id, $update) {
        $this->db->where('nim', $id);
        $this->db->update('mahasiswa', $update);
    }

    function infoMhs() {
        $this->db->where('status', 'Active');
        $data = $this->db->get('info');
        if ($data->num_rows > 0) {
            return $data->row();
        }
    }

    function info() {
        $data = $this->db->get('info');
        if ($data->num_rows > 0) {
            return $data->result();
        }
    }

    function infoStat($id, $active) {
        $this->db->where('id', $id);
        $this->db->update('info', $active);
    }

    function updateProfilDosen($id, $data) {
        $this->db->where('nip', $id);
        $this->db->update('dosen', $data);
    }

}

?>
